41 research outputs found

    Happy-GLL: modular, reusable and complete top-down parsers for parameterized nonterminals

    Full text link
    Parser generators and parser combinator libraries are the most popular tools for producing parsers. Parser combinators use the host language to provide reusable components in the form of higher-order functions with parsers as parameters. Very few parser generators support this kind of reuse through abstraction and even fewer generate parsers that are as modular and reusable as the parts of the grammar for which they are produced. This paper presents a strategy for generating modular, reusable and complete top-down parsers from syntax descriptions with parameterized nonterminals, based on the FUN-GLL variant of the GLL algorithm. The strategy is discussed and demonstrated as a novel back-end for the Happy parser generator. Happy grammars can contain `parameterized nonterminals' in which parameters abstract over grammar symbols, granting an abstraction mechanism to define reusable grammar operators. However, the existing Happy back-ends do not deliver on the full potential of parameterized nonterminals as parameterized nonterminals cannot be reused across grammars. Moreover, the parser generation process may fail to terminate or may result in exponentially large parsers generated in an exponential amount of time. The GLL back-end presented in this paper implements parameterized nonterminals successfully by generating higher-order functions that resemble parser combinators, inheriting all the advantages of top-down parsing. The back-end is capable of generating parsers for the full class of context-free grammars, generates parsers in linear time and generates parsers that find all derivations of the input string. To our knowledge, the presented GLL back-end makes Happy the first parser generator that combines all these features. This paper describes the translation procedure of the GLL back-end and compares it to the LALR and GLR back-ends of Happy in several experiments.Comment: 15 page

    Purely functional GLL parsing

    Get PDF
    Generalised parsing has become increasingly important in the context of software language design and several compiler generators and language workbenches have adopted generalised parsing algorithms such as GLR and GLL. The original GLL parsing algorithms are described in low-level pseudo-code as the output of a parser generator. This paper explains GLL parsing differently, defining the FUN-GLL algorithm as a collection of pure, mathematical functions and focussing on the logic of the algorithm by omitting implementation details. In particular, the data structures are modelled by abstract sets and relations rather than specialised implementations. The description is further simplified by omitting lookahead and adopting the binary subtree representation of derivations to avoid the clerical overhead of graph construction. Conventional parser combinators inherit the drawbacks from the recursive descent algorithms they implement. Based on FUN-GLL, this paper defines generalised parser combinators that overcome these problems. Th

    Checking cryptographic API usage with composable annotations

    Get PDF

    GLL parsing with flexible combinators

    Get PDF
    At SLE in 2014, Ridge presented the P3 combinator library with which parsers can be developed for left-recursive, non-deterministic and ambiguous grammars. A combinator expression in P3 yields a binarised grammar reflecting the expression's structure. The grammar is given to an underlying, generalised parsing procedure computing all derivations. In this paper we present a combinator library with a similar architecture to P3, adjusting it to avoid grammar binarisation. Avoiding binarisation has a significant positive effect on the running times of the underlying parsing procedure, which we demonstrate using real-world grammars. Binarisation is avoided by restricting the applicability of combinators, resulting in combinator expressions closely resembling BNF fragments. Usability is recovered by defining coercions that automatically convert expressions where necessary. As the underlying parsing procedure, we use a purely functional variant of generalised top-down (GLL) parsing

    Funcons for HGMP:the fundamental constructs of homogeneous generative meta-programming

    Get PDF
    The PLanCompS project proposes a component-based approach to programming-language development in which fundamental constructs (funcons) are reused across language definitions. Homogeneous Generative Meta-Programming (HGMP) enables writing programs that generate code as data, at run-time or compile-time, for manipulation and staged evaluation. Building on existing formalisations of HGMP, this paper introduces funcons for HGMP and demonstrates their usage in component-based semantics

    eFLINT: a domain-specific language for executable norm specifications

    Get PDF
    Software systems that share potentially sensitive data are subjected to laws, regulations, policies and/or contracts. The monitoring, control and enforcement processes applied to these systems are currently to a large extent manual, which we rather automate by embedding the processes as dedicated and adaptable software services in order to improve efficiency and effectiveness. This approach requires such regulatory services to be closely aligned with a formal description of th

    TNPO2 variants associate with human developmental delays, neurologic deficits, and dysmorphic features and alter TNPO2 activity in Drosophila

    Get PDF
    Transportin-2 (TNPO2) mediates multiple pathways including non-classical nucleocytoplasmic shuttling of >60 cargoes, such as developmental and neuronal proteins. We identified 15 individuals carrying de novo coding variants in TNPO2 who presented with global developmental delay (GDD), dysmorphic features, ophthalmologic abnormalities, and neurological features. To assess the nature of these variants, functional studies were performed in Drosophila. We found that fly dTnpo (orthologous to TNPO2) is expressed in a subset of neurons. dTnpo is critical for neuronal maintenance and function as downregulating dTnpo in mature neurons using RNAi disrupts neuronal activity and survival. Altering the activity and expression of dTnpo using mutant alleles or RNAi causes developmental defects, including eye and wing deformities and lethality. These effects are dosage dependent as more severe phenotypes are associated with stronger dTnpo loss. Interestingly, similar phenotypes are observed with dTnpo upregulation and ectopic expression of TNPO2, showing that loss and gain of Transportin activity causes developmental defects. Further, proband-associated variants can cause more or less severe developmental abnormalities compared to wild-type TNPO2 when ectopically expressed. The impact of the variants tested seems to correlate with their position within the protein. Specifically, those that fall within the RAN binding domain cause more severe toxicity and those in the acidic loop are less toxic. Variants within the cargo binding domain show tissue-dependent effects. In summary, dTnpo is an essential gene in flies during development and in neurons. Further, proband-associated de novo variants within TNPO2 disrupt the function of the encoded protein. Hence, TNPO2 variants are causative for neurodevelopmental abnormalities
    corecore